#include <iostream>
#include <limits>
#include <stdio.h>
#include <stdlib.h>
#include <fstream>
#include <string.h>
#include "AdjacencyList.cpp"
#include "AllSSPSimple.cpp"
#include "AllSSPBinomial.cpp"
#include "AllSSPFHeap.cpp"
#include "Input.cpp"

using namespace std;

void displayHelp()
{
    cout<<"Switch required:\n-r: Random Mode\n-is: Simple Mode\n-ib: B-Heap Mode\n-if: F-Heap Mode";
    cout<<"\n-is <fileName>: Simple Mode file input\n-ib <fileName>: B-Heap Mode file input\n-if <fileName>: F-Heap Mode file input";
}

int main(int argc, char *argv[])
{
    if (argc == 1 || argc > 3)
    {
        displayHelp();
        exit(0);
    }

    AdjacencyList list;

    if (argc == 3)
    {
        fileInput(argv[2], &list);
    }
    else if (!strcmp (argv[1], "-r"))
    {
        randomInput(&list);
        exit(0);
    }
    else if (!strcmp (argv[1], "-ib") || !strcmp (argv[1], "-if") || !strcmp (argv[1], "-is"))
    {
        interactiveUserInput(&list);
    }
    else
    {
        displayHelp();
        exit(0);
    }

    if (!strcmp (argv[1], "-is"))
    {
        cout<<"\nSimple Scheme:";
        AllSSPSimple* simpleScheme = new AllSSPSimple(&list);
        simpleScheme->computeShortestPath();
        simpleScheme->display();
        delete (simpleScheme);
    }
    else if (strcmp (argv[1], "-ib") == 0)
    {
        cout<<"\nB-Heap Scheme";
        AllSSPBinomial* bHeapScheme = new AllSSPBinomial(&list);
        bHeapScheme->computeShortestPath();
        bHeapScheme->display();
        delete (bHeapScheme);
    }
    else if (strcmp (argv[1], "-if") == 0)
    {
        cout<<"\nF-Heap Scheme";
        AllSSPFibonacci* fHeapScheme = new AllSSPFibonacci(&list);
        fHeapScheme->computeShortestPath();
        fHeapScheme->display();
        delete (fHeapScheme);
    }
    else
    {
        displayHelp();
        exit(0);
    }
    cout<<"\n\ndone..\n";
    return 0;
}

